Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

Q is empty.


QTRS
  ↳ Overlay + Local Confluence

Q restricted rewrite system:
The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

Q is empty.

The TRS is overlay and locally confluent. By [15] we can switch to innermost.

↳ QTRS
  ↳ Overlay + Local Confluence
QTRS
      ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))


Using Dependency Pairs [1,13] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

APP(app(append, app(app(cons, x), xs)), ys) → APP(append, xs)
APP(app(flatwith, f), app(leaf, x)) → APP(cons, app(f, x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))
APP(app(flatwith, f), app(node, xs)) → APP(flatwithsub, f)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(append, xs), ys)
APP(app(flatwith, f), app(leaf, x)) → APP(app(cons, app(f, x)), nil)
APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(cons, x), app(app(append, xs), ys))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(append, app(app(flatwith, f), x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(flatwith, f)
APP(app(flatwith, f), app(leaf, x)) → APP(f, x)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
QDP
          ↳ EdgeDeletionProof

Q DP problem:
The TRS P consists of the following rules:

APP(app(append, app(app(cons, x), xs)), ys) → APP(append, xs)
APP(app(flatwith, f), app(leaf, x)) → APP(cons, app(f, x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))
APP(app(flatwith, f), app(node, xs)) → APP(flatwithsub, f)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(append, xs), ys)
APP(app(flatwith, f), app(leaf, x)) → APP(app(cons, app(f, x)), nil)
APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(cons, x), app(app(append, xs), ys))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(append, app(app(flatwith, f), x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(flatwith, f)
APP(app(flatwith, f), app(leaf, x)) → APP(f, x)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
We deleted some edges using various graph approximations

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
QDP
              ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

APP(app(append, app(app(cons, x), xs)), ys) → APP(append, xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwith, f), app(leaf, x)) → APP(cons, app(f, x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))
APP(app(flatwith, f), app(node, xs)) → APP(flatwithsub, f)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(append, xs), ys)
APP(app(flatwith, f), app(leaf, x)) → APP(app(cons, app(f, x)), nil)
APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(append, app(app(cons, x), xs)), ys) → APP(app(cons, x), app(app(append, xs), ys))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(append, app(app(flatwith, f), x))
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(flatwith, f)
APP(app(flatwith, f), app(leaf, x)) → APP(f, x)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 2 SCCs with 8 less nodes.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ AND
QDP
                    ↳ QDPOrderProof
                  ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

APP(app(append, app(app(cons, x), xs)), ys) → APP(app(append, xs), ys)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13]. Here, we combined the reduction pair processor with the A-transformation [14] which results in the following intermediate Q-DP Problem.
Q DP problem:
The TRS P consists of the following rules:

APPEND(cons(x, xs), ys) → APPEND(xs, ys)

R is empty.
The set Q consists of the following terms:

append(nil, x0)
append(cons(x0, x1), x2)
flatwith(x0, leaf(x1))
flatwith(x0, node(x1))
flatwithsub(x0, nil)
flatwithsub(x0, cons(x1, x2))

We have to consider all minimal (P,Q,R)-chains.


The following pairs can be oriented strictly and are deleted.


APP(app(append, app(app(cons, x), xs)), ys) → APP(app(append, xs), ys)
The remaining pairs can at least be oriented weakly.
none
Used ordering: Combined order from the following AFS and order.
APPEND(x1, x2)  =  x1
cons(x1, x2)  =  cons(x1, x2)

Recursive Path Order [2].
Precedence:
trivial


The following usable rules [14] were oriented: none



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ AND
                  ↳ QDP
                    ↳ QDPOrderProof
QDP
                        ↳ PisEmptyProof
                  ↳ QDP

Q DP problem:
P is empty.
The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ AND
                  ↳ QDP
QDP
                    ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwith, f), app(leaf, x)) → APP(f, x)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13].


The following pairs can be oriented strictly and are deleted.


APP(app(flatwith, f), app(leaf, x)) → APP(f, x)
The remaining pairs can at least be oriented weakly.

APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
Used ordering: Combined order from the following AFS and order.
APP(x1, x2)  =  x1
app(x1, x2)  =  app(x2)
flatwith  =  flatwith
node  =  node
flatwithsub  =  flatwithsub
cons  =  cons
leaf  =  leaf

Recursive Path Order [2].
Precedence:
[flatwith, cons] > flatwithsub > app1
node > flatwithsub > app1


The following usable rules [14] were oriented: none



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ AND
                  ↳ QDP
                  ↳ QDP
                    ↳ QDPOrderProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13]. Here, we combined the reduction pair processor with the A-transformation [14] which results in the following intermediate Q-DP Problem.
Q DP problem:
The TRS P consists of the following rules:

FLATWITHSUB(f, cons(x, xs)) → FLATWITHSUB(f, xs)
FLATWITHSUB(f, cons(x, xs)) → FLATWITH(f, x)
FLATWITH(f, node(xs)) → FLATWITHSUB(f, xs)

R is empty.
The set Q consists of the following terms:

append(nil, x0)
append(cons(x0, x1), x2)
flatwith(x0, leaf(x1))
flatwith(x0, node(x1))
flatwithsub(x0, nil)
flatwithsub(x0, cons(x1, x2))

We have to consider all minimal (P,Q,R)-chains.


The following pairs can be oriented strictly and are deleted.


APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwith, f), x)
APP(app(flatwithsub, f), app(app(cons, x), xs)) → APP(app(flatwithsub, f), xs)
The remaining pairs can at least be oriented weakly.

APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)
Used ordering: Combined order from the following AFS and order.
FLATWITHSUB(x1, x2)  =  FLATWITHSUB(x2)
cons(x1, x2)  =  cons(x1, x2)
FLATWITH(x1, x2)  =  FLATWITH(x2)
node(x1)  =  x1

Recursive Path Order [2].
Precedence:
[FLATWITHSUB1, cons2, FLATWITH1]


The following usable rules [14] were oriented: none



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ EdgeDeletionProof
            ↳ QDP
              ↳ DependencyGraphProof
                ↳ AND
                  ↳ QDP
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

APP(app(flatwith, f), app(node, xs)) → APP(app(flatwithsub, f), xs)

The TRS R consists of the following rules:

app(app(append, nil), ys) → ys
app(app(append, app(app(cons, x), xs)), ys) → app(app(cons, x), app(app(append, xs), ys))
app(app(flatwith, f), app(leaf, x)) → app(app(cons, app(f, x)), nil)
app(app(flatwith, f), app(node, xs)) → app(app(flatwithsub, f), xs)
app(app(flatwithsub, f), nil) → nil
app(app(flatwithsub, f), app(app(cons, x), xs)) → app(app(append, app(app(flatwith, f), x)), app(app(flatwithsub, f), xs))

The set Q consists of the following terms:

app(app(append, nil), x0)
app(app(append, app(app(cons, x0), x1)), x2)
app(app(flatwith, x0), app(leaf, x1))
app(app(flatwith, x0), app(node, x1))
app(app(flatwithsub, x0), nil)
app(app(flatwithsub, x0), app(app(cons, x1), x2))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 0 SCCs with 1 less node.